import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
    // components: ()=> import('@/views/home.vue')
  },
  {
    path: '/home',
    name: 'Home',
    redirect: '/home/book-store',
    component: ()=> import('../views/home.vue'),
    children: [
      {
        path: 'book-shelf',
        name: 'bookShelf',
        component: () => import('../views/home/bookShelf.vue'),
      },
      {
        path: 'book-class',
        name: 'bookClass',
        component: () => import('../views/home/bookClass.vue')
      },
      {
        path: 'book-store',
        name: 'bookStore',
        component: () => import('../views/home/bookStore.vue'),
      },
      {
        path: 'user',
        name: 'User',
        component: () => import('../views/home/user.vue')
      },
    ]
  },
  {
    path: '/book-text/:bid?/:cid?/m',
    name: 'bookText',
    component: ()=> import('../views/bookText.vue')
  },
  {
    path: '/book-detail/:id?/:bookName?/m',
    name: 'bookDetail',
    component: ()=> import('../views/bookDetail.vue')
  },
  {
    path: '/book-chater/:id?/m',
    name: 'bookChater',
    component: ()=> import('../views/bookChater.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
